package org.wx.io.netty.tcp.server;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import org.wx.io.netty.tcp.codec.TcpDecoder;
import org.wx.io.netty.tcp.codec.TcpEncoder;

/**
 * @description:
 * @author: wangxun
 * @createDate: 2021/2/22
 * @version: 1.0
 */
public class TcpServerInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast(new TcpEncoder())
                .addLast(new TcpDecoder())
                .addLast(new TcpServerHandler());
    }
}
